#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "BasicHashTable.hh"

int main()
{
    char key[1024] = {0};
    void *value = NULL;
    
    HashTable *table = HashTable::create(STRING_HASH_KEYS);

    memcpy(key, "num1", strlen("num1") + 1);
    value = (void *)0x1;
    table->Add(key, value);

    memcpy(key, "num2", strlen("num2") + 1);
    value = (void *)0x2;
    table->Add(key, value);

    memcpy(key, "num3", strlen("num3") + 1);
    value = (void *)0x3;
    table->Add(key, value);
    
    memcpy(key, "num4", strlen("num4") + 1);
    value = (void *)0x4;
    table->Add(key, value);
    
    memcpy(key, "num5", strlen("num5") + 1);
    value = (void *)0x5;
    table->Add(key, value);

    memcpy(key, "num6", strlen("num6") + 1);
    value = (void *)0x6;
    table->Add(key, value);

    memcpy(key, "num7", strlen("num7") + 1);
    value = (void *)0x7;
    table->Add(key, value);

    memcpy(key, "num8", strlen("num8") + 1);
    value = (void *)0x8;
    table->Add(key, value);

    memcpy(key, "num9", strlen("num9") + 1);
    value = (void *)0x9;
    table->Add(key, value);

    memcpy(key, "num10", strlen("num10") + 1);
    value = (void *)0xa;
    table->Add(key, value);

    memcpy(key, "num11", strlen("num11") + 1);
    value = (void *)0xb;
    table->Add(key, value);

    memcpy(key, "num12", strlen("num12") + 1);
    value = (void *)0xc;
    table->Add(key, value);

    memcpy(key, "num13", strlen("num13") + 1);
    value = (void *)0xd;
    table->Add(key, value);

    memcpy(key, "num14", strlen("num14") + 1);
    value = (void *)0xe;
    table->Add(key, value);
    
        
    table->debug_print();

    if ((value = table->Lookup("num11")) != NULL)
    {
        printf("Lookup for key num11 value[0x%p]\n", value);
    }

    table->Remove("num1");
    table->Remove("num2");
    table->Remove("num3");
    table->Remove("num4");
    table->Remove("num5");
    table->Remove("num6");
    table->Remove("num7");
    table->Remove("num8");
    table->Remove("num9");
    table->Remove("num10");
    table->Remove("num11");

    table->debug_print();
    
    return 0;
}
